package com.sinochem.yunlian.ship.zuul;

import com.sinochem.yunlian.ship.common.service.HttpClientService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;

import com.sinochem.yunlian.ship.zuul.config.UserPrincipal;
import com.sinochem.yunlian.ship.gateway.ratelimit.EnableZuulRateLimit;
import com.sinochem.yunlian.ship.gateway.ratelimit.config.IUserPrincipal;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients({"com.sinochem.yunlian.ship.zuul.feign"})
@EnableZuulProxy
@EnableZuulRateLimit
@Import(HttpClientService.class)  //导入HttpClient模块
public class ZuulBootstrap {
	
    public static void main(String[] args) {
        SpringApplication.run(ZuulBootstrap.class, args);
    } 
    
    @Bean
    @Primary
    IUserPrincipal userPrincipal(){
        return new UserPrincipal();
    }
    
}
